﻿using IBatisNet.DataMapper;
using IBatisNet.DataMapper.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;

namespace iCodeStudio.IBatis
{
    public class MyIBatisNet
    {
        public static ISqlMapper SqlMap;
        private static readonly object syncObj = new object();
        static MyIBatisNet()
        {
            if (SqlMap == null)
            {
                lock (syncObj)
                {
                    if (SqlMap == null)
                    {
                        Assembly assembly = Assembly.Load("iCodeStudio.IBatis");
                        Stream stream = assembly.GetManifestResourceStream("iCodeStudio.IBatis.Config.sqlmap.config");
                        DomSqlMapBuilder builder = new DomSqlMapBuilder();
                        SqlMap = builder.Configure(stream);
                    }
                }
            }
        }
    }
}
